home *** CD-ROM | disk | FTP | other *** search
-
- TErrorTable component for Borland Delphi
-
- Are you frustrated with not being able to get more specific information when
- encountering BDE errors in Delphi, especially with Paradox tables and validity
- checks ? Wouldn't it be nice if a min/max check fails and you could find out
- what field is having the problem ? Wouldn't it be nice if you could have a
- central application exception handler and still be able to deal with (using
- plain, non-cryptic messages) table-specific errors, such as key violations ?
-
- Freeware, including source, from OnTYme Software.
-
- TErrorTable is a descendant from TTable that allows you to attach specific
- event handlers to the component for BDE errors such as key violations, min/
- max checks, required checks (see below), etc. The component also logs the
- specific error contexts regarding the error when it occurs in properties in
- the component. This allows you to react to specific events for specific
- tables and retrieve the necessary information to build a nice, non-frightening
- message to display to the users. Unfortunately, the built-in exception
- messages in the BDE are far from understandable to an end user and are next
- to impossible to parse in message format to derive the information needed
- by you, the programmer, as to what exactly went wrong. This is especially
- true when dealing with highly-marketed end-user oriented programs using
- local databases such as Paradox or DBase. To take full advantage of the
- component, especially with Paradox files, turn off all of the built-in Delphi
- validity checks for the TFields by making the Required property false and
- the Min/Max properties 0. This will allow the TErrorTable to let the Paradox
- validity checks take effect directly from the tables and will permit the
- TErrorTable component to generate all exception events properly for you.
-
- Currently, the errors that are trapped are as follows:
-
- Key violations
- Minimum validity checks
- Maximum validity checks
- Required checks
- Master record missing (with referential integrity)
- Lookup table fail
- Record lock fail
- Record unlock fail
- File is locked by another user
- Directory is locked by another user
- Other errors (none of the above)
-
- ******************************************************************************
- One note, the required checks will not execute if you do not have a TField
- object defined for a field and do not turn off (set to False) the Required
- property. The error will be trapped as a EDatabaseError exception, so to get
- the most mileage out of the TErrorTable component you should always define
- TField objects and set their Required properties to False. This will let
- Paradox and the TErrorTable component handle all exceptions.
- ******************************************************************************
-
- All events pass the exception on to the event handler, so you are always able
- to just display the original exception message if you wish. Please note,
- currently if you DO NOT attach an event handler the exception will be
- essentially passed on to the main application exception handler, or if none
- is present, on to the the Delphi default exception handling.
-
- The event handlers are as follows:
-
- OnKeyViolation
- OnMinCheckFail
- OnMaxCheckFail
- OnFldRequired
- OnMasterMissing
- OnLookupTblFail
- OnRecLockFail
- OnRecUnLockFail
- OnFileIsLocked
- OnDirIsLocked
- OnOtherErrors
-
- New events in this version:
-
- OnMultipleNetFiles - Triggered when there are multiple .NET files or .LCK
- files in use, usually caused by an abnormal termination
- of the current program in previous session.
-
- The error context properties are as follows:
-
- ErrorToken
- ErrorTableName
- ErrorFieldName
- ErrorImageRow
- ErrorUserName
- ErrorFileName
- ErrorIndexName
- ErrorDirName
- ErrorKeyName
- ErrorAlias
- ErrorDriveName
- ErrorNativeCode
- ErrorNativeMsg
- ErrorLineNumber
- ErrorCapability
-
-
- New properties in this version:
-
- ErrorFieldDispName - Contains the "nice" field name from the DisplayLabel
- property of the TField component for which the error
- is associated.
-
- ErrorFieldMinValue - Contains the minimum value (as a string) directly
- from the Paradox files for use in formatting an
- error message that contains what the minimum value
- should be for an entry.
-
- ErrorFieldMaxValue - Contains the maximum value (as a string) directly
- from the Paradox files for use in formatting an
- error message that contains what the maximum value
- should be for an entry.
-
- ******************************************************************************
- Please note, all of these properties are read-only. Also, don't get upset
- if you can't retrieve any context information such as ErrorKeyName when a
- key violation error occurs, for some reason the BDE doesn't log any info on
- this error when it occurs. Sorry !
- ******************************************************************************
-
- As an example, suppose you attempt to place a TTable in edit mode and the
- record you are attempting to edit is locked by another user. In this case,
- the OnRecLockFail event will be triggered and the ErrorTableName property will
- contain the table name and the ErrorUserName will contain the name of the
- user who currently has the record locked.
-
- Well that's about it, if you have any questions or comments please let me
- know at CServe ID 73302,2561 or you can give me a buzz at 407-246-0930.
- Also, if you make any improvements to the component please send me a copy
- so that I can implement in any future versions. Currently, I plan on
- adding security error trapping (Paradox tables only) as well as some goodies
- for filters and packing. What I'd like to see is a combination of all of
- the extended TTable components on the Delphi forum so that there is one
- component that contains all of these great features. I'm also investigating
- the feasability of rollback and recovery for Paradox and DBase tables, so let
- me know if you have any insight into this one.
-
- About me
-
- I specialize in manufacturing applications, specifically make-to-order, and
- am looking also to build some high level components for configurations and
- bills of material. I come from a FoxPro/Clipper background and am always
- happy to swap stories about the differences, likes/dislikes, regarding the
- two environments. I personally don't like coding in FoxPro or Clipper too
- much anymore if you know what I mean. By the way, if you're located in
- Orlando FL. and are interested, I'm looking to form a Delphi study/user group
- to promote discussion regarding problems and solutions with Delphi in the
- local community. Give me a call and we'll talk some more. My office is in
- my home, but it's fairly large so I could probably fit about 10-12 people
- tops. I'm located in College Park in Orlando, in case you're wondering......
-
- Tim Young
- OnTYme Software
-
- Bug Fix and Enhancement History
-
- 8/24/95 - Original TErrorTable
- 9/7/95 - Fixed problem with the BeforeEdit, BeforePost, etc. events
- getting turned off by the TErrorTable. Added properties for
- ErrorFieldDispName for the "nice" field name from the DisplayLabel
- property of the TFields and ErrorFieldMinValue and
- ErrorFieldMaxValue properties for retrieving the min/max string
- values when a min/max error occurs. Added event for "Multiple
- .NET files in use" exception (very common).
- 9/12/95 - Fixed problem with error properties getting cleared due to an
- internal ordering problem with my BDE calls. Also cleaned up
- the code a bit.
-
- ******************************************************************************
- I make no warranties regarding the use of this component and will not be held
- responsible for any damages incurred from the use of this component. I will
- try to fix any bugs found in a reasonably timely manner, but in the case of
- this not happening you have the source so fix it yourself.
- ******************************************************************************
-
- (C) Copyright 1995 OnTYme Software
-